package cm.cool.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cm.cool.web.bean.Admin;
import cm.cool.web.service.LoginService;
import cm.cool.web.util.respon.R;

/**
 * 登录
 * @author fangzhenxing
 * time:2017年10月13日19:53:06
 */
@Controller
@RequestMapping(value="/Login")
public class LoginController {
	
	@Autowired
	private LoginService loginService;
	
	
	/**
	 * 用户登录
	 * @param user 用户实体
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/login")
	public R login(Admin user,HttpServletResponse response){
		return loginService.login(user,response);
	}
	
	/**
	 * 登出系统
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/loginOut")
	public R loginForward(Admin user,HttpServletRequest request){
		return loginService.loginOut(user, request);
	}
}
